package com.base.myproject.client.HR.analysis;

import com.extjs.gxt.charts.client.Chart;
import com.extjs.gxt.charts.client.model.ChartModel;
import com.extjs.gxt.charts.client.model.Legend;

import com.extjs.gxt.charts.client.model.Legend.Position;
import com.extjs.gxt.charts.client.model.charts.PieChart;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.base.myproject.client.busi.JDBCModelData;
import com.base.myproject.client.busi.BaseStore;
public class EmploylevelAnslysis extends ContentPanel{
	
	
	BaseStore<JDBCModelData> store;
	String sql = "select employlevel,count(employlevel) as total from bcode_job where employlevel is not null GROUP BY employlevel";;
	
	public EmploylevelAnslysis(){
		init();
		setWidth(405);
		setHeight(280);
		this.setHeaderVisible(false);
	}
	
	public void init(){  
	    String url = "chart/open-flash-chart.swf";      
		final Chart chart = new Chart(url);  
	    chart.setBorders(true);  
	    chart.setChartModel(getPieChartData());  
		       
	    add(chart);      
	}
	
	public ChartModel getPieChartData(){
		
		ChartModel cm = new ChartModel("雇员级别统计图",  
				         "font-size: 14px; font-family: Verdana; text-align: center;");  
		cm.setBackgroundColour("fffff5");  
		Legend lg = new Legend(Position.RIGHT, true);  
		lg.setPadding(10);  
		cm.setLegend(lg);  
				       
		PieChart pie = new PieChart();  
		pie.setAlpha(0.5f);  
		pie.setNoLabels(true);  
		pie.setTooltip("#label# 共#val#人<br>占#percent#");  
		pie.setColours("#ff0000", "#00aa00", "#0000ff", "#ff9900", "#ff00ff","#FFFF33","#5555FF");  
					  
		pie.addSlices(new PieChart.Slice(7, "A级部门经理","A级部门经理"));  
		pie.addSlices(new PieChart.Slice(15, "B级部门经理", "B级部门经理"));  
	    pie.addSlices(new PieChart.Slice(86, "督导", "督导"));  
	    pie.addSlices(new PieChart.Slice(4, "高级行政", "高级行政"));  
		pie.addSlices(new PieChart.Slice(23, "实习生", "实习生")); 
		pie.addSlices(new PieChart.Slice(6, "特殊等级", "特殊等级"));
		pie.addSlices(new PieChart.Slice(248, "员工", "员工"));
		  		   
		cm.addChartConfig(pie);  
		return cm;  
	}
	
}
